/* 
  学习目标：受控组件-hooks
  */
import React, { useState } from 'react';

export default function App() {
  // 1. state控制value

  const [value, setValue] = useState('');
  const [checked, setChecked] = useState(false);
  // 2. onChange事件改变状态
  return (
    <div>
      <input type="text" value={value} onChange={(e) => setValue(e.target.value)} />
      <input type="checkbox" checked={checked} onChange={(e) => setChecked(e.target.checked)} />
    </div>
  );
}
